﻿using System;
using System.Collections.Generic;
using System.Text;
using MyIni;

namespace CadStrategy2013.CgqStyle
{
    public class CommuMachine
    {
        private string m_path;
        private int m_portCount;
        public Dictionary<string, Cgq2013> PortDic=new Dictionary<string,Cgq2013>();

        public CommuMachine(string path,  int count=4)
        {
            m_path = path;
            m_portCount = count;
        }

        private void CfgDic()
        {

        }

        private void CfgDc()
        {
            #region 读配置
            IniFile inifile = new IniFile(m_path + "\\dc.txt");
            inifile.Load();
            int zlbsCount = inifile.GetInt("直流道岔", "sum", 0);
            int zlbsLuShu = inifile.GetInt("直流道岔", "传感器采集路数", 4);
            int zlCgqCount;
            if (zlbsCount == 0)
            {
                zlCgqCount = 0;
            }
            else
            {
                zlCgqCount = (zlbsCount-1) / zlbsLuShu + 1;
            }
            int jlbsCount = inifile.GetInt("交流道岔", "sum", 0);
            int jlbsLuShu = inifile.GetInt("交流道岔", "传感器采集路数", 2);
            int jlCgqCount;
            if (jlbsCount == 0)
            {
                jlCgqCount = 0;
            }
            else
            {
                jlCgqCount = (jlbsCount-1) / jlbsLuShu + 1;
            }
            #endregion

            if (zlCgqCount + jlCgqCount < 33)
            {
                for (int i = 0; i < zlCgqCount; i++)
                {
                    Cgq2013 zlbs = new ZLBsClass("直流道岔表示","I-"+(i+1).ToString());
                    zlbs.GetDevList(inifile, i);
                    PortDic.Add(zlbs.Id, zlbs);
                }
            }
            else
            {
            }
        }
    }
}
